package org.caijin.springrabbitMQ.mq;

import com.rabbitmq.client.AMQP;
import com.rabbitmq.client.Channel;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.io.IOException;


@Component
// Stream队列可以发消息，但是消费消息不能指定offset,同时指定消费速度
// Stream
@RabbitListener(queues = "testStream")
public class TestStreamConsumer {
    @RabbitHandler
    public void process(String message, Channel channel) throws IOException {
        channel.basicQos(1);
        System.out.println("[testStream] received message: " + message);
    }
}
